package com.infindo.appcreate.zzyj.entity;

import static javax.persistence.GenerationType.SEQUENCE;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.infindo.appcreate.zzyj.util.DateTimeUtil;

@Entity
@Table(name = "zzyj_activity", schema = "public")
public class Activity implements java.io.Serializable {

    private static final long serialVersionUID = -961556270368780758L;
    
    private Long id;
    private String code;
    private String title;
    private Date time;
    private String address;
    private String image;//for list 
    private String images;
    private String desc;
    
    private String timeF;//format time item
    
    public Activity(){
        
    }
    
   public Activity(String code, String title, Date time, String address, String image, String images, String desc){
        super();
        this.code = code;
        this.title = title;
        this.time = time;
        this.address = address;
        this.image = image;
        this.images = images;
        this.desc = desc;
   }

	@SequenceGenerator(name = "generator", sequenceName = "seq_zzyj_activity",allocationSize=1)
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "_desc")
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
    
    @Column(name = "images")
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }

    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }

    @Column(name = "time")
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }

    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }

    @Column(name = "image")
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    
    @Transient
  	public String getTimeF() {
      	if(null != this.time){
      		return DateTimeUtil.DateToString("yyyy.MM.dd hh:mm", this.time);
      	}
  		return null;
  	}
  	public void setTimeF(String timeF) {
  		this.timeF = timeF;
  	}
	
}
